#pragma once

#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "pdh.lib")

#include <windows.h>
#include <mmsystem.h>
#include <pdh.h>

namespace System
{
class Win32Timer
{
public:
	Win32Timer(void);

	~Win32Timer(void);

	bool Initialize();

	void Update();

	float GetElapsedTime();

	float GetTime();

	int GetFPS();

	int GetCpuPercentage();

private:
	INT64 mFrequency;
	float mTicksPerMs;

	INT64 mStartTime;
	float mFrameTime;
	INT64 mCurrentTime;
	INT64 mPrevTime;

	//FPS
	int mFps, mCount;
	unsigned long mFPSStartTime;

	//CPU
	bool mCanReadCpu;
	HQUERY mQueryHandle;
	HCOUNTER mCounterHandle;
	unsigned long mLastSampleTime;
	long mCpuUsage;
};
}